From 64ef092f37c5fc5bee7832705ed347fc62804682 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 6 Aug 2023 16:59:08 -0600 Subject: [PATCH] use std::prev instead of --c.end() (#1154) --c.end() is not guaranteed to compile. --- smplrout.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smplrout.cc b/smplrout.cc index 67187c638..0e5985ec4 100644 --- a/smplrout.cc +++ b/smplrout.cc @@ -58,6 +58,7 @@ #include #include // for strtol +#include // for prev #include // for QDateTime #include // for QHash @@ -208,7 +209,7 @@ void SimplifyRouteFilter::routesimple_head(const route_head* rte) neighborhood goner = errormap.last(); goner.wpt->wpt_flags.marked_for_deletion = 1; // errormap.remove(lastKey()); // with Qt 5.12.12, 5.15.2 results in asan heap-use-after-free errors in build_extra_tests.sh - errormap.erase(--errormap.end()); // in Qt6 can use cend(). + errormap.erase(std::prev(errormap.end())); // in Qt6 can use cend(). // wpthash.remove(goner.wpt); // removal not necessary /* recompute neighbors of point marked for deletion. */ -- 2.30.2